<%@ page language="java" pageEncoding="UTF-8"%>
<%@ include file="../../../init.jsp"%>

<div class="p20" ms-controller="model">
	<div class="mt-10 mb-10 text-right">
		<div class="form search-bar">
			<div class="form-inline">
				<label class="form-label">名称:</label>
				<div class="form-block-box">
					<input class="form-input w200" autocomplete="off" ms-duplex="srh.name" id="name" placeholder="">
				</div>
			</div>
			<div class="form-inline btn-operation">
				<button class="btn" ms-click="loadVal()"><i class="iconfont icon-search"></i>搜索</button>
				<button class="btn btn-primary" ms-click="reset()"><i class="iconfont icon-refresh"></i>重置</button>
				<Auth:show mcode="${tablePrefix}-${tableSubName?lower_case}-add">
					<button class="btn" ms-click="add()"><i class="iconfont icon-plus2"></i>添加</button>
				</Auth:show>
			</div>
		</div>
	</div>
	<div class="alert-info">共<b class="fc-blue" ms-text="page.totalRow"></b>条数据</div>
    <table class="table table-hover">
        <thead>
			<tr>
			<#list columns as d>
			<#if d.pk != d.colName && d.colName!='created' && d.colName!='status'>
				<th><#if d.remark != ''>${d.remark}</#if><#if d.remark == ''>${d.colName}</#if></th>
			</#if>
			</#list>
				<th>操作</th>
			</tr>
		</thead>
		<tbody>
			<tr ms-repeat="list">
			<#list columns as d>
			<#if d.pk != d.colName && d.colName!='created' && d.colName!='status'>
				<td ms-text="el.${d.colName}"></td>
			</#if>
			</#list>
                <td>
	            	<Auth:show mcode="${tablePrefix}-${tableSubName?lower_case}-edit">
	                <a class="fc-blue link" ms-on-click="edit(el)">
	                	<i class="iconfont icon-edit inline-block"></i>编辑</a>
	                </Auth:show>
	                <Auth:show mcode="${tablePrefix}-${tableSubName?lower_case}-del">
	                <a class="fc-red link" ms-on-click="del(el)">
	                	<i class="iconfont icon-delete inline-block"></i>删除</a>
	                </Auth:show>
                </td>
			</tr>
			<tr>
				<td ms-if="list.length==0" colspan="${columnsSize-2}">
                	<div class="empty">
	                    <img src="${path}/mpStyle/images/defaultImg/no-data.png" alt="" class="empty-image">
	                    <p class="empty-description">暂无数据</p>
	                </div>
                </td>
			</tr>
		</tbody>
	</table>
	<div class="page">
		<div ms-page="list"></div>
	</div>
</div>
<script type="text/javascript">
var model = avalon.define({
	$id : "model",
	url:'${path}${requestPrefix}/${tableSubName?uncap_first}/get${tableSubName?cap_first}ListData.htm',
	list:[],
	srh:{},
	page:{},
	load:function(){},
	reload:function(){},
	add:function(){
		layerOpenAdd('700px','400px','${path}${requestPrefix}/${tableSubName?uncap_first}/${tableSubName?uncap_first}Add.htm')
	},
	edit:function(el){
		layerOpenEdit('700px','400px','${path}${requestPrefix}/${tableSubName?uncap_first}/${tableSubName?uncap_first}Edit.htm?id='+el.${pkName})
	},
	del:function(el){
		optionDelete('确定删除吗？',"${path}${requestPrefix}/${tableSubName?uncap_first}/remove.htm",{'id':el.${pkName}},model)
	},
	loadVal:function(){
		model.srh.name=$("#name").val();
		model.load();
	},
	reset:function(){
		$("#name").val("");
		model.srh.name=null;
		model.reload();
	}
});
avalon.scan();
</script>